#pragma once
#include "DXAMLCommon.h"



class CMILMatrix
{
public: 
	CMILMatrix(bool fInitialize);
	CMILMatrix();
	void SetToEmpty();
	void SetToIdentity();
	XBOOL IsEmpty();
	XBOOL IsIdentity();
	XBOOL IsTranslationOnly();
	XBOOL IsScaleOnly();
	XBOOL IsScaleOrTranslationOnly();
	XBOOL IsAxisAlignedScaleOrTranslationReal();
	void Transform(const struct XPOINTD * srcPoints, struct XPOINTD * destPoints, XUINT32 count);
	void Transform(const struct XPOINTF * srcPoints, struct XPOINTF * destPoints, XUINT32 count);
	void TransformBounds(const struct XRECTF_RB * pSource, struct XRECTF_RB * pTarget);
	void TransformBounds(const struct XRECTF_WH * pSource, struct XRECTF_WH * pTarget);
	void TransformAsVectors(const struct XPOINTF * srcPoints, struct XPOINTF * destPoints, XUINT32 count);
	void Append(const CMILMatrix & that);
	void AppendTranslation(const XFLOAT & translateX, const XFLOAT & translateY);
	void Prepend(const CMILMatrix & that);
	void Scale(XFLOAT rScaleX, XFLOAT rScaleY);
	int Invert();
	void InferAffineMatrix(const struct XPOINTF * pTargetPoints, const struct XRECTF_WH & rcSource);
	XFLOAT GetMaxFactor();
	XFLOAT GetM11();
	XFLOAT GetM12();
	XFLOAT GetM21();
	XFLOAT GetM22();
	XFLOAT GetDx();
	XFLOAT GetDy();
	void SetM11(XFLOAT r);
	void SetM12(XFLOAT r);
	void SetM21(XFLOAT r);
	void SetM22(XFLOAT r);
	void SetDx(XFLOAT dx);
	void SetDy(XFLOAT dY);
	XFLOAT GetDeterminant();
	void GetScaleDimensions(XFLOAT * prScaleX, XFLOAT * prScaleY);
	bool operator==(const CMILMatrix & other);
	bool operator!=(const CMILMatrix & other);
	XFLOAT _11;
	XFLOAT _12;
	XFLOAT _21;
	XFLOAT _22;
	XFLOAT _31;
	XFLOAT _32;
};



